from selenium.webdriver.common.by import By
from common.basepage import BasePage
from conf.constant import cons


class MemberPage(BasePage):

    """会员首页"""
    #  _locator = (By.XPATH, '')

    """会员列表页面"""
    # 会员列表标签
    member_list_locator = (By.XPATH, '//*[@class="page-title"]/li[text()="会员列表"]')
    # 门店选项
    shop_btn_locator = (By.XPATH, '//*[@class="searchRight"]//input[@placeholder="请选择"]')
    # 选中门店,根据门店名字，可以变更门店
    shop_checked_locator = (By.XPATH, '//span[text()="火少门店"]')
    # 门店选项，可随机选择一个
    shop_selects_locator = (By.XPATH, '//*[contains(@x-placement,"start")]//li')
    # 会员输入框
    member_input_locator = (By.XPATH, '//*[@placeholder="请输入会员姓名／手机号"]')
    # 列表会员姓名，帮助潜客转为会员和新增会员验证的
    member_name_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//div[2]/p[1]')
    # 查询按钮
    search_btn_locator = (By.XPATH, '//*[@class="el-input__icon el-icon-search"]')
    # 启用状态按钮
    enabled_btn_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//div[@role="switch"]')
    # 开单按钮，
    billing_btn_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//a[text()="开单"]')
    # 随机选择会员操作
    # billing_btn_locator = (By.XPATH, '//tr[@class="no-table"]/following-sibling::tr//a[text()="开单"]')
    # 详情按钮
    detail_btn_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//a[text()="详情"]')
    # 随机选择会员操作
    # detail_btn_locator = (By.XPATH, '//tr[@class="no-table"]/following-sibling::tr//a[text()="详情"]')
    # 编辑按钮
    edit_btn_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//a[text()="编辑"]')
    # 随机选择会员操作
    # edit_btn_locator = (By.XPATH, '//tr[@class="no-table"]/following-sibling::tr//a[text()="编辑"]')
    # 预约按钮
    appointment_btn_locator = (By.XPATH, '//*[@class="table"]/tbody/tr[2]//a[text()="预约"]')
    # 随机选择会员操作
    # appointment_btn_locator = (By.XPATH, '//tr[@class="no-table"]/following-sibling::tr//a[text()="预约"]')
    """详情页面"""
    # 关闭页面按钮
    closeDetail_btn_locator = (By.XPATH, '//*[@class="page-sub-title"]/*[text()="关闭页面"]')
    # 编辑按钮
    detailEdit_btn_locator = (By.XPATH, '//*[@class="page-sub-title"]/*[text()="编辑"]')
    # 开单按钮
    detailBilling_btn_locator = (By.XPATH, '//*[@class="page-sub-title"]/*[text()="开单"]')
    # 预约按钮
    detailAppointment_btn_locator = (By.XPATH, '//*[@class="page-sub-title"]/*[text()="预约"]')
    # 增减成长值按钮
    detailAdjust_btn_locator = (By.XPATH, '//*[@class="page-sub-title"]/*[text()="增减成长值"]')
    # 姓名
    detail_name_locator = (By.XPATH, '//*[@class="archivesRight"]/h2')
    # 微信号
    detail_wechat_locator = (By.XPATH, '//*[@class="desc-info"]/li[4]/span[2]')
    # 备注
    detail_remark_locator = (By.XPATH, '//*[@class="desc-info"]/li[10]/span[2]')
    # 成长值
    detail_growthValue_locator = (By.XPATH, '//*[@class="desc-info"]/li[8]/span[2]')
    # 成长值增加选项
    growthValue_increase_locator = (By.XPATH,'//*[@class="ctrl-label"]/label[1]')
    # 成长值减少选项
    growthValue_decrease_locator = (By.XPATH, '//*[@class="ctrl-label"]/label[2]')
    # 成长值输入框
    growthValue_input_locator = (By.XPATH, '//*[@class="member-corn"]/input')
    # 成长值确认按钮
    growthValue_confirmBtn_locator = (By.XPATH, '//*[@aria-label="增减成长值"]//span/button[2]')
    # 卡券中心标签
    cardTicket_center_locator = (By.XPATH,'//*[contains(text(),"卡券中心")]')
    # 预约记录标签
    reservation_record_locator = (By.XPATH,'//*[contains(text(),"预约记录")]')
    # 卡项抵扣记录标签
    cardItem_deductionRecord_locator = (By.XPATH,'//*[contains(text(),"卡项抵扣记录")]')
    # 消费记录标签
    consumption_record_locator = (By.XPATH,'//*[contains(text(),"消费记录")]')
    # 服务日志标签
    service_log_locator = (By.XPATH,'//*[@aria-controls="pane-four"]')
    # 添加服务日志按钮
    addLog_btn_locator = (By.XPATH,'//*[@class="el-tabs__content"]/button')
    # 描述输入框
    description_input_locator = (By.XPATH, '//*[@class="el-textarea"]/textarea')
    # 添加日志确认按钮
    addLog_confirmBtn_locator = (By.XPATH, '//*[@aria-label="添加服务日志"]//button[2]')
    # 日志信息
    log_info_locator = (By.XPATH,'//*[@class="serviceLog"]/li[1]/div[3]/p[2]')


    """会员导入页面"""
    # 会员导入标签
    member_import_locator = (By.XPATH, '//*[@class="page-title"]/li[text()="会员导入"]')
    # 下载导入模板按钮
    download_template_locator = (By.XPATH, '//*[@class="download-btn"]')
    # 文件上传按钮
    upload_btn_locator = (By.XPATH, '//*[@class="el-upload-dragger"]')
    #
    upload_file_locator = (By.XPATH, '//input[@name="file"]')
    # 提交按钮
    submit_uploadFile_locator = (By.XPATH, '//*[@class="submit-btn"]')
    # 提交后的提示信息
    prompt_msg_locator = (By.XPATH, '//*[@class="upload-inners"]/p[1]')
    # 重复上传的提示信息===>手机号已是该店铺会员
    repeat_msg_locator = (By.XPATH, '//*[@class="upload-inners"]/p[3]')
    # 确定按钮
    upload_confirm_locator = (By.XPATH, '//*[@class="el-button el-button--primary"]')

    """会员导出页面"""
    # 会员导出标签
    member_export_locator = (By.XPATH, '//*[@class="page-title"]/li[text()="会员导出"]')
    # 选择门店按钮
    select_exportShop_locator = (By.XPATH, '//*[@class="el-input__inner"]')
    # 下拉选择门店，随机选择一个
    checked_exportShop_locator = (By.XPATH, '//*[contains(@x-placement,"start")]//li')
    # 导出会员，导出后没有提示信息无法断言是否导出成功
    export_btn_locator = (By.XPATH, '//*[@class="Tpbut"]/span')

    """新增会员页面"""
    # 新增会员按钮
    newMembers_btn_locator = (By.XPATH, '//li[@id="newMembers"]')
    # 姓名输入框
    name_input_locator = (By.XPATH, '//input[@placeholder="请输入姓名"]')
    # 手机输入框
    mobile_input_locator = (By.XPATH, '//input[@placeholder="请输入手机号"]')
    # 性别选择
    sex_selects_locator = (By.XPATH, '//*[contains(text(),"性别")]/following-sibling::label')
    # 生日
    date_btn_locator = (By.XPATH, '//input[@placeholder="选择日期"]')
    # 生日选择，随机选择一个
    date_selects_locator = (By.XPATH, '//table[@class="el-date-table"]/tbody//td')
    # 微信输入框
    wechat_input_locator = (By.XPATH, '//input[@placeholder="请输入微信号"]')
    #  会员来源下拉框按钮
    source_btn_locator = (By.XPATH, '//*[contains(text(),"会员来源")]/following-sibling::div')
    # 会员下拉框，随机选择一个
    source_selects_locator = (By.XPATH, '//*[contains(@x-placement,"start")]//li')
    # 所属门店下拉框按钮
    department_shop_locator = (By.XPATH, '//*[contains(text(),"所属门店")]/following-sibling::div')
    # 所属门店下拉框，随机选择一个,与会员首页的共用
    # 营销顾问下拉按钮
    adviser_btn_locator = (By.XPATH, '//*[contains(text(),"营销顾问")]/following-sibling::div')
    # 营销顾问下拉框，随机选择一个
    adviser_selects_locator = (By.XPATH, '//*[contains(@x-placement,"start")]//li')
    # 备注输入框
    remark_input_locator = (By.XPATH, '//*[@class="form-textarea"]')
    # 提交按钮
    submit_btn_locator = (By.XPATH, '//*[text()="提交"]')

    """收银台页面"""
    # 收银台信息
    cashierDesk_locator = (By.XPATH, '//*[text()="收银台"]')

    """开单-服务页面"""
    # 服务标签
    serveLabel_locator = (By.XPATH, '//*[@id="tab-1"]/span')
    # 服务选项，有多项可随机选择
    serve_selects_locator = (By.XPATH, '//*[@id="pane-1"]/div/dl/dd')
    """开单-产品页面"""
    # 产品标签
    productLabel_locator = (By.XPATH, '//*[@id="tab-2"]/span')
    # 产品选项，有多项可随机选择
    product_selects_locator = (By.XPATH, '//*[@id="pane-2"]/div/dl/dd')
    # 产品时间
    product_spec_locator = (By.XPATH, '//*[contains(@x-placement,"top")]//li')
    # 产品确认按钮
    product_submit_locator = (By.XPATH,'//*[contains(@x-placement,"top")]//button[2]')
    """消费清单公共页面"""
    # 改价
    alter_price_locator = (By.XPATH, '//dd[@class="conslistLi_dl_mod"]')
    # 降价折扣
    decrease_price_locator = (By.XPATH, '//span[@class="el-input-number__decrease"]')
    # 权益选择按钮
    select_equity_locator = (By.XPATH, '//span[@class="el-popover__reference"]')
    # 选择权益，随机选择
    equity_selects_locator = (By.XPATH, '//dd[contains(@class,"equityK")]')
    # 不使用会员权益
    noEquity_select_locator = (By.XPATH, '//dd[@class="equityK_1"]')
    # 使用会员权益
    useEquity_select_locator = (By.XPATH, '//dd[@class="equityK_2"]')
    # 使用会员卡-次卡,有多个时可随机选择
    clubCard_time_locator = (By.XPATH, '//dd[@class="equityK_3"]')
    # 使用会员卡-充值卡,有多个时可随机选择
    clubCard_recharge_locator = (By.XPATH, '//dd[@class="equityK_4"]')
    # 服务技师按钮
    service_technician_locator = (By.XPATH, '//span[@class="technician el-popover__reference"]')
    # 选择服务技师,有多个时可随机选择
    technician_checkbox_locator   = (By.XPATH, '//*[contains(@x-placement,"top")]//label[@class="el-checkbox checkboxText"]')
    # 选择点客,选择技师后才能激活选择
    customer_checkbox_locator = (By.XPATH, '//label[@class="el-checkbox textCk"]/span[@class="el-checkbox__label"]')
    # 营销顾问按钮
    marketing_adviser_locator = (By.XPATH, '//span[@class="adviser el-popover__reference"]')
    # 选择营销顾问，有多个时可随机选择
    adviser_checkbox_locator = (By.XPATH, '//*[contains(@x-placement,"top")]//li')
    # 优惠券按钮
    coupon_btn_locator = (By.XPATH, '//b[@class="el-popover__reference"]')
    # 选择不使用优惠券
    noCoupon_select_locator = (By.XPATH, '//li[@class="Coupon1"]')
    # 优惠券,有多个时可随机选择，可能选到不使用优惠券
    coupon_selects_locator = (By.XPATH, '//*[contains(@x-placement,"top")]//li')
    # 整单优惠按钮
    discount_btn_locator = (By.XPATH, '//*[@placeholder="请选择整单优惠"]')
    # 整单优惠下拉选项
    discount_selects_locator = (By.XPATH, '//*[contains(@x-placement,"start")]//li')
    # 收款按钮
    paying_btn_locator = (By.XPATH, '//span[@class="b"]')
    # 挂单按钮
    restingOrder_btn_locator = (By.XPATH, '//span[@class="h"]')

    """开卡页面"""

    # 开卡按钮
    activateCardLabel_locator = (By.XPATH, '//li[text()="开卡"]')
    # 充值卡选项
    rechargeCard_locator = (By.XPATH, '//li[text()="充值卡"]')
    # 次卡选项
    countCard_locator = (By.XPATH, '//li[text()="次卡"]')
    # 折扣卡选项
    discountCard_locator = (By.XPATH, '//li[text()="折扣卡"]')
    # 套卡选项
    SetCard_locator = (By.XPATH, '//li[text()="套卡"]')
    # 时限卡选项
    timeLimitCard_locator = (By.XPATH, '//li[text()="时限卡"]')
    # 每种卡项下的页面，有多个卡，可以随机选择
    cardItem_locator = (By.XPATH, '//dl[@class="order_lis1 clearfix"]/dd')

    """充值页面"""
    # 充值标签
    rechargeLabel_locator = (By.XPATH, '//li[text()="充值"]')
    # 充值卡选项，可随机选择一个
    refillCard_locator = (By.XPATH, '//dl[@class="order_lis2 clearfix"]/dd')
    # 充值金额输入框
    rechargeAmount_input_locator = (By.XPATH, '//*[contains(text(),"充值金额")]/following-sibling::span//input')
    # 赠送金额输入框
    givenAmount_input_locator = (By.XPATH, '//*[contains(text(),"赠送金额")]/following-sibling::span//input')
    """结算页面"""

    """订单信息"""
    # 订单编号
    order_number_locator = (By.XPATH, '//*[@class="paymentInfoList clearfix"]/li[1][contains(text(),"2")]')
    """结算方式"""
    # 在线支付标签
    online_payment_locator = (By.XPATH, '//*[text()="在线支付"]')
    # 扫码收款选项
    sweepCode_collection_locator = (By.XPATH, '//*[text()="扫码收款"]')
    # 生成收款码选项
    generate_paymentCode_locator = (By.XPATH, '//*[text()="生成收款码"]')
    # 线下记账标签
    offline_account_locator = (By.XPATH, '//*[text()="线下记账"]')
    # 微信
    weixin_locator = (By.XPATH, '//p[@class="weixin active"]')
    # 支付宝
    zhifubao_locator = (By.XPATH, '//p[@class="zhifubao"]')
    # 现金
    xianjin_locator = (By.XPATH, '//p[@class="xianjin"]')
    # 刷卡
    shuaka_locator = (By.XPATH, '//p[@class="shuaka"]')
    # 确认结算
    confirm_payment_locator = (By.XPATH, '//div[@class="tab-content"]/div[4]')
    # 返回重新下单
    return_btn_locator = (By.XPATH, '//div[@class="fahnui"]')
    """验证订单信息"""
    # 付款成功查看订单按钮
    paySuccess_checkOrder_locator = (By.XPATH, '//a[@class="btns" and text()="查看订单"]')
    # 付款成功订单状态
    paySuccess_orderStatus_locator = (By.XPATH,'//span[@class="icon-wancheng"]/following-sibling::*')
    # 挂单成功信息
    restingSuccess_locator = (By.XPATH, '//p[@class="p_text"]')
    # 挂单查看订单按钮
    resting_checkOrder_locator = (By.XPATH, '//button[@class="el-button el-button--small"]/span[text()="查看订单"]')
    # 挂单订单状态
    resting_orderStatus_locator = (By.XPATH,'//div[@class="status wait"]//span[contains(text(),"待付款")]')

    """会员列表功能"""

    def search_member(self,member_info):
        """查询会员"""
        # 下拉选择门店
        # self.visible_only_wait(self.select_shop_locator).click()
        # self.presence_only_wait(self.checked_shop_locator).click()
        # 输入会员手机号或姓名
        member_elem = self.visible_only_wait(self.member_input_locator)
        member_elem.clear()
        member_elem.send_keys(member_info)
        # 点击查询
        self.visible_only_wait(self.search_btn_locator).click()

    def click_newmember_btn(self):
        """点击新增会员按钮"""
        self.clickable_wait(self.newMembers_btn_locator).click()

    def click_enabled_btn(self):
        """点击启用状态按钮"""
        self.clickable_wait(self.enabled_btn_locator).click()

    def click_detail_btn(self):
        """点击详情按钮"""
        self.clickable_wait(self.detail_btn_locator).click()

    def click_edit_btn(self):
        """点击编辑按钮"""
        self.clickable_wait(self.edit_btn_locator).click()

    def clicK_billing_btn(self):
        """点击开单按钮"""
        self.clickable_wait(self.billing_btn_locator).click()

    def click_appointment_btn(self):
        """点击预约按钮"""
        self.clickable_wait(self.appointment_btn_locator).click()

    def get_member_name(self):
        """获取会员姓名"""
        return self.sleep_wait(self.member_name_locator)

    """新增会员功能"""
    def input_name(self,name):
        """输入会员姓名"""
        name_input = self.visible_only_wait(self.name_input_locator)
        name_input.clear()
        name_input.send_keys(name)

    def input_mobile(self,mobile):
        """输入会员姓名"""
        mobile_input = self.visible_only_wait(self.mobile_input_locator)
        mobile_input.clear()
        mobile_input.send_keys(mobile)

    def select_sex(self):
        """选择性别"""
        optinons = self.presence_least_wait(self.sex_selects_locator)
        self.random_select_click(optinons)

    def select_birthday(self):
        """选择生日"""
        self.clickable_wait(self.date_btn_locator).click()
        options = self.visible_least_wait(self.date_selects_locator)
        self.random_select_click(options)

    def input_wechat(self,wechat="dy20200604"):
        """输入微信号"""
        wechat_input = self.visible_only_wait(self.wechat_input_locator)
        wechat_input.clear()
        wechat_input.send_keys(wechat)

    def select_source(self):
        """选择会员来源"""
        self.clickable_wait(self.source_btn_locator).click()
        options = self.visible_least_wait(self.source_selects_locator)
        self.random_select_click(options)

    # def select_shop(self):
    #     """选择门店"""
          # 随机选择门店生成会员，列表查询难于验证
    #     self.clickable_wait(self.department_shop_locator).click()
    #     options = self.visible_least_wait(self.shop_selects_locator)
    #     self.random_JSselect_click(options)

    def select_new_adviser(self):
        """选择营销顾问"""
        self.clickable_wait(self.adviser_btn_locator).click()
        options = self.visible_least_wait(self.adviser_selects_locator)
        self.random_JSselect_click(options)

    def input_remark(self,remark="会员备注"):
        """输入备注"""
        self.visible_only_wait(self.remark_input_locator).send_keys(remark)

    def submit_newMember(self):
        """新增会员提交"""
        self.clickable_wait(self.submit_btn_locator).click()

    def new_member(self,name,mobile):
        """新增会员"""
        self.click_newmember_btn()
        self.input_name(name)
        self.input_mobile(mobile)
        self.select_sex()
        self.select_birthday()
        self.input_wechat()
        self.select_source()
        self.select_new_adviser()
        self.input_remark()
        self.submit_newMember()

    def new_member_overview(self,name,mobile):
        """新增会员"""
        self.input_name(name)
        self.input_mobile(mobile)
        self.select_sex()
        self.select_birthday()
        self.input_wechat()
        self.select_source()
        self.select_new_adviser()
        self.input_remark()
        self.submit_newMember()

    """详情页面功能"""
    def close_detail(self):
        """关闭详情页面"""
        self.clickable_wait(self.closeDetail_btn_locator).click()

    def get_member_msg(self):
        """关闭页面，返回会员首页"""
        return self.visible_only_wait(self.member_list_locator)

    def click_detailEdit(self):
        """点击详情页编辑按钮"""
        self.clickable_wait(self.detailEdit_btn_locator).click()

    def edit_member(self,name):
        """编辑会员信息"""
        self.input_name(name)
        self.submit_newMember()

    def get_detailMember_name(self):
        """获取详情页面的会员姓名"""
        return self.presence_only_wait(self.detail_name_locator)

    def click_detailBilling(self):
        """点击详情页面的开单按钮"""
        self.clickable_wait(self.detailBilling_btn_locator).click()

    def click_detailAppointment(self):
        """点击详情页面的预约按钮"""
        self.clickable_wait(self.detailAppointment_btn_locator).click()

    def click_detailAdjust(self):
        """点击增减成长值按钮"""
        self.clickable_wait(self.detailAdjust_btn_locator).click()

    def adjust_growthValue(self):
        """调整成长值"""
        # 按默认的增加1来确认
        self.clickable_wait(self.growthValue_confirmBtn_locator).click()

    def get_detail_growthValue(self):
        """获取详情页面的成长值"""
        return self.sleep_wait(self.detail_growthValue_locator)

    def click_serviceLog(self):
        """点击服务日志标签"""
        self.visible_only_wait(self.service_log_locator).click()

    def add_serviceLog(self):
        """添加服务日志"""
        # 点击添加服务日志按钮
        self.clickable_wait(self.addLog_btn_locator).click()
        # 添加日志描述
        description = self.visible_only_wait(self.description_input_locator)
        description.clear()
        description.send_keys("添加服务日志")
        # 确认提交
        self.clickable_wait(self.addLog_confirmBtn_locator).click()

    def get_log_info(self):
        """获取添加的日志信息"""
        return self.visible_only_wait(self.log_info_locator)

    """开单主功能"""
    """服务选择"""
    def click_serveLabel(self):
        """点击服务标签"""
        self.visible_only_wait(self.serveLabel_locator).click()

    def select_serve(self,number=1):
        """选择服务
        默认选择一个，可自行添加
        """
        # 定到到多个服务
        serves = self.visible_least_wait(self.serve_selects_locator)
        # 随机选择
        self.random_select_click(serves,number=1)

    def alter_price(self):
        """改价"""
        # 点击改价
        self.visible_only_wait(self.alter_price_locator).click()
        # 点击折扣按钮
        self.visible_only_wait(self.decrease_price_locator).click()

    def select_equity(self):
        """选择权益"""
        # 点击请选择按钮
        self.visible_only_wait(self.select_equity_locator).click()
        # 随机选择一个权益
        equities = self.visible_least_wait(self.equity_selects_locator)
        self.random_select_click(equities)

    def select_technician(self):
        """选择服务技师"""
        # 点击服务技师按钮
        self.sleep_wait(self.service_technician_locator).click()
        # 随机选择一个技师
        technicians = self.visible_least_wait(self.technician_checkbox_locator)
        self.random_select_click(technicians)

    def select_customer(self):
        """选择点客"""
        customers = self.visible_least_wait(self.customer_checkbox_locator)
        self.random_select_click(customers)

    def select_marketing_adviser(self):
        """选择营销顾问"""
        # 点击营销顾问按钮
        self.sleep_wait(self.marketing_adviser_locator).click()
        # 随机选择一个顾问
        advisers = self.visible_least_wait(self.adviser_checkbox_locator)
        self.random_JSselect_click(advisers)

    def select_coupon(self):
        """选择优惠券"""
        # 点击优惠券
        self.sleep_wait(self.coupon_btn_locator).click()
        # 随机选择一个优惠券
        coupons = self.visible_least_wait(self.coupon_selects_locator)
        self.random_JSselect_click(coupons)

    def select_discount(self):
        """选择整单优惠"""
        # 点击整单优惠
        self.clickable_wait(self.discount_btn_locator).click()
        # 随机选择一个
        discounts = self.visible_least_wait(self.discount_selects_locator)
        self.random_select_click(discounts)

    def paying_submit(self):
        """点击收款"""
        self.sleep_wait(self.paying_btn_locator).click()

    def restingOrder_submit(self):
        """点击挂单"""
        self.clickable_wait(self.restingOrder_btn_locator).click()

    def confirm_payment_submit(self, payment='weixin'):
        """确认结算"""
        # 线下记账
        if payment == 'weixin':
            self.clickable_wait(self.weixin_locator).click()
        elif payment == 'zhifubao':
            self.clickable_wait(self.zhifubao_locator).click()
        elif payment == 'xianjin':
            self.clickable_wait(self.xianjin_locator).click()
        elif payment == 'shuaka':
            self.clickable_wait(self.shuaka_locator).click()
        else:
            print("暂不支持该支付方式")

        self.sleep_wait(self.confirm_payment_locator).click()

    def order_again(self):
        """返回重新下单"""
        self.sleep_wait(self.return_btn_locator).click()

    def billing_serve(self):
        """选择服务-开单"""
        # 多个服务，随机选择
        self.select_serve()
        # 改价
        self.alter_price()
        # 选择权益
        self.select_equity()
        # 选择服务技师
        self.select_technician()
        # 选择技师后，才能点击点客
        self.select_customer()
        # 选择营销顾问
        self.select_marketing_adviser()
        # 选择优惠券
        self.select_coupon()
        # 选择整单优惠
        self.select_discount()

    def appointment_billing_serve(self):
        """预约——开单，选择服务"""
        # 选择权益
        self.select_equity()
        # 选择营销顾问
        self.select_marketing_adviser()
        # 选择优惠券
        self.select_coupon()
        # 选择整单优惠
        self.select_discount()

    """产品选择"""
    def click_productLabel(self):
        """点击服务标签"""
        self.visible_only_wait(self.productLabel_locator).click()

    def select_product(self):
        """选择产品"""
        products = self.visible_least_wait(self.product_selects_locator)
        self.random_select_click(products)

    def select_spec(self):
        """选择产品规格"""
        specs = self.visible_least_wait(self.product_spec_locator)
        for i in specs:
            i.click()

    def product_submit(self):
        """产品确认"""
        self.clickable_wait(self.product_submit_locator).click()

    def billing_product(self):
        """开单-产品"""
        # 点击开单
        # self.clicK_billing_btn()
        # 点击产品标签
        self.click_productLabel()
        # 选择产品，有多项可随机选择
        self.select_product()
        # 选择产品信息
        self.select_spec()
        # 产品确认
        self.product_submit()
        # 改价
        self.alter_price()
        # 选择权益
        self.select_equity()
        # 选择营销顾问
        self.select_marketing_adviser()
        # 选择优惠券
        self.select_coupon()
        # 选择整单优惠
        self.select_discount()

    """开卡功能"""
    def click_activateCardLabel(self):
        """点击开卡标签"""
        self.visible_only_wait(self.activateCardLabel_locator).click()

    def click_rechargeCard(self):
        """点击充值卡选项"""
        self.visible_only_wait(self.rechargeCard_locator).click()

    def click_countCard(self):
        """点击次卡选项"""
        self.visible_only_wait(self.countCard_locator).click()

    def click_discountCard(self):
        """点击折扣卡选项"""
        self.visible_only_wait(self.discountCard_locator).click()

    def click_SetCard(self):
        """点击套卡选项"""
        self.visible_only_wait(self.SetCard_locator).click()

    def click_timeLimitCard(self):
        """点击时限卡选项"""
        self.visible_only_wait(self.timeLimitCard_locator).click()

    def select_card(self):
        """随机选择一种类型的卡"""
        cards = self.visible_least_wait(self.cardItem_locator)
        self.random_select_click(cards)

    def activate_card(self):
        """选择卡进行开卡"""
        # 点击开单
        # self.clicK_billing_btn()
        # 点击开卡标签
        self.click_activateCardLabel()
        # 多种卡类型，随机选择
        self.select_card()
        # 选择营销顾问
        self.select_marketing_adviser()

    """充值功能"""
    def click_rechargeLabel(self):
        """点击服务标签"""
        self.visible_only_wait(self.rechargeLabel_locator).click()

    def select_refillCard(self):
        """随机选择一个充值卡"""
        refillCards = self.visible_least_wait(self.refillCard_locator)
        self.random_select_click(refillCards)

    def input_rechargeAmount(self,amount="1000"):
        """输入充值金额"""
        rechargeAmount = self.sleep_wait(self.rechargeAmount_input_locator)
        # 页面输入无法清除
        rechargeAmount.clear()
        rechargeAmount.send_keys(amount)

    def input_givenAmount(self,amount="100"):
        """输入赠送金额"""
        givenAmount = self.sleep_wait(self.givenAmount_input_locator)
        givenAmount.clear()
        givenAmount.send_keys(amount)

    def click_offline(self):
        """点击线下记账标签"""
        self.visible_only_wait(self.offline_account_locator).click()

    def recharge_card(self):
        """充值卡充值"""
        # 点击开单
        # self.clicK_billing_btn()
        # 点击充值标签
        self.click_rechargeLabel()
        # 选择一个充值卡
        self.select_refillCard()
        # # 输入充值金额
        # self.input_rechargeAmount()
        # # 输入赠送金额
        # self.input_givenAmount()
        # 选择营销顾问
        self.select_marketing_adviser()

    def get_order_number(self):
        """获取结算页面的订单编号"""
        return self.sleep_wait(self.order_number_locator)

    def get_cashierDesk_msg(self):
        """获取收银台信息"""
        return self.visible_only_wait(self.cashierDesk_locator)

    def get_paySuccessOrder_msg(self):
        """获取下单成功的订单状态"""
        self.clickable_wait(self.paySuccess_checkOrder_locator).click()
        return self.visible_only_wait(self.paySuccess_orderStatus_locator)

    def get_restingOrder_msg(self):
        """获取挂单成功的订单状态"""
        self.clickable_wait(self.resting_checkOrder_locator).click()
        return self.visible_only_wait(self.resting_orderStatus_locator)

    """会员导入功能"""
    def click_member_import(self):
        """打开会员导入页面"""
        self.clickable_wait(self.member_import_locator).click()

    def upload_file(self):
        """点击文件上传按钮"""
        # self.clickable_wait(self.upload_btn_locator).click()
        # self.upload(cons.UPlOAD_PATH)

        elem = self.presence_only_wait(self.upload_file_locator)
        elem.send_keys(cons.FILE_PATH)

    def submit_uploadFile(self):
        """提交上传文件"""
        self.clickable_wait(self.submit_uploadFile_locator).click()

    def get_upload_msg(self):
        """获取上传成功信息"""
        return self.sleep_wait(self.prompt_msg_locator)

    def get_repeatUpload_msg(self):
        """获取重复上传的信息"""
        return self.visible_only_wait(self.repeat_msg_locator)

    def upload_confirm(self):
        """点击上传确认按钮，返回会员首页"""
        self.sleep_wait(self.upload_confirm_locator).click()




















